package com.yang.action;

import com.yang.service.ProductService;
import com.yang.util.RespEntity;
import com.yang.util.RespUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/productBySql")
public class ProductBySqlAction extends HttpServlet {
    ProductService productService = new ProductService();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //根据名字查
        String name=req.getParameter("sqlName");
        System.out.println(name);
        //根据子分类查
        String sid=req.getParameter("sid");
        RespEntity respEntity = productService.queryBySql(name,sid);
        RespUtil.sendJSON(resp,respEntity);
    }
}
